package com.duowei.diandan.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;

import com.duowei.diandan.db.entry.Tcmc;

import java.util.List;

@Dao
public interface TcmcDao {

    @Query("SELECT * FROM tcmc")
    List<Tcmc> findAll();

    @Query("SELECT DISTINCT lbmc FROM tcmc ORDER BY lbmc")
    List<String> findDistinctLbmc();

    @Query("SELECT * FROM tcmc WHERE lbmc = :lbmc")
    List<Tcmc> findByLbmc(String lbmc);

//    @Query("SELECT lbmc FROM tcmc WHERE xmbh = :xmbh LIMIT 1")
//    String findLmmcByXmbh(String xmbh);

    @Insert
    void insert(List<Tcmc> list);

    @Query("DELETE FROM tcmc")
    void deleteAll();
}
